package com.woniuxy.afterloan.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.afterloan.entity.AfterLoans;
import com.woniuxy.afterloan.provider.AfterLoanMapperProvider;
import com.woniuxy.commons.entity.AfterLoan;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface AfterLoanMapper extends BaseMapper<AfterLoans> {
    @Select("select * from after_loan ")
    @Results({
            @Result(id = true,column = "aid", property = "aid"),
            @Result(column = "order_id", property = "orderId"),
            @Result(column = "due_date", property = "dueDate"),
            @Result(column = "overdue_days", property = "overdueDays")
    })
    List<AfterLoan> getAll();


    @SelectProvider(type = AfterLoanMapperProvider.class, method = "select")
    @Results({
            @Result(id = true, column = "aid", property = "aid"),
            @Result(column = "order_id", property = "orderId"),
            @Result(column = "due_date", property = "dueDate"),
            @Result(column = "overdue_days", property = "overdueDays")
    })
    List<AfterLoan> getByCondition(AfterLoan afterLoan);

    @UpdateProvider(type = AfterLoanMapperProvider.class, method = "update")
    void update(AfterLoan afterLoan);

    @Delete("delete from after_loan where aid = #{id}")
    void delete(int id);


}
